package ocean.chinacraft.common.world.gen;

import ocean.chinacraft.common.ModBlocks;
import net.minecraft.block.Block;
import net.minecraftforge.common.util.Lazy;

/**
 * 矿物类型
 *
 * @author zhang
 * @since 2021/11/11
 */
public enum OreType {

    /**
     * 铜矿石
     */
    COPPER_ORE(Lazy.of(ModBlocks.COPPER_ORE), 8, 1, 64),

    /**
     * 锡矿
     */
    TIN_ORE(Lazy.of(ModBlocks.TIN_ORE), 8, 1, 64),

    /**
     * 银矿石
     */
    SILVER_ORE(Lazy.of(ModBlocks.SILVER_ORE), 4, 1, 48),

    /**
     * 玉原石
     */
    JADE_ORE(Lazy.of(ModBlocks.JADE_ORE), 12, 1, 48),

    /**
     * 大理石
     */
    MARBLE(Lazy.of(ModBlocks.MARBLE), 10, 32, 42)

    ;

    private final Lazy<Block> block;

    private final int count;

    private final int minHeight;

    private final int maxHeight;

    OreType(Lazy<Block> block, int count, int minHeight, int maxHeight) {
        this.block = block;
        this.count = count;
        this.minHeight = minHeight;
        this.maxHeight = maxHeight;
    }

    public Lazy<Block> getBlock() {
        return block;
    }

    public int getCount() {
        return count;
    }

    public int getMinHeight() {
        return minHeight;
    }

    public int getMaxHeight() {
        return maxHeight;
    }

    public static OreType get(Block block) {
        for (OreType ore : values()) {
            if (block == ore.block) {
                return ore;
            }
        }
        return null;
    }
}
